package lambda;

import java.sql.Array;
import java.util.ArrayList;
import java.util.Comparator;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/24 16:02
 * @Copyright 博为峰
 */
public class LambdaDemo {
    public static void main(String[] args) {
//        m1();
//        m2();
        MyInter myInter = new MyInter() {
            @Override
            public void show() {
                System.out.println("匿名内部类");
            }
        };

        myInter = () -> System.out.println("匿名内部类");

    }

    private static void m2() {
        final ArrayList<Student> students = new ArrayList<>();
        students.add(new Student("zhangsan", 20));
        students.add(new Student("lisi", 30));
        students.sort(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o1.getAge() - o2.getAge();
            }
        });

        students.sort((o1, o2) -> {
            return o1.getAge() - o2.getAge();
        });

        students.sort((o1, o2) -> o1.getAge() - o2.getAge());
    }

    private static void m1() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("abc");
            }
        }).start();

        new Thread(() -> {
            System.out.println("abc");
        }).start();

    }
}
